package com.frank.oj.service.entity.training.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.frank.model.entity.training.TrainingCategory;
import com.frank.oj.mapper.TrainingCategoryMapper;
import com.frank.oj.service.entity.training.TrainingCategoryEntityService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author frank
 * @Date 2024/3/23
 */
@Service
public class TrainingCategoryEntityServiceImpl extends ServiceImpl<TrainingCategoryMapper, TrainingCategory> implements TrainingCategoryEntityService {
    @Resource
    private TrainingCategoryMapper trainingCategoryMapper;

    @Override
    public List<TrainingCategory> getTrainingCategory() {
        LambdaQueryWrapper<TrainingCategory> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.isNull(TrainingCategory::getGid);
        return trainingCategoryMapper.selectList(queryWrapper);
    }

    @Override
    public TrainingCategory getTrainingCategoryByTrainingId(Long id) {

        return trainingCategoryMapper.getTrainingCategoryByTrainingId(id);
    }
}
